<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>网点</title>
    <link rel="stylesheet" href="css/AllStyle.css" />
    <link rel="stylesheet" href="css/iconfont.css" />
    <link rel="stylesheet" href="css/swiper-3.3.1.min.css" />
    <link rel="stylesheet" href="css/font-awesome.css" />
    <script type="text/javascript" src="js/common.js" ></script>
    <script type="text/javascript" src="js/data.js" ></script>
    <script type="text/javascript" src="js/tmpl.js" ></script>
</head>
<body>
<section style="width: 100%;height:100%;position: absolute;overflow: hidden;">
	<section class="FormBlockOne">
		<nav>
			<span id="LogoButtom"><img width="50%" style="margin:20px auto;display: block;" src="images/logo2.png"></span>
			<ul class="HomeNavLeft">
				<li class="videoClassify"><i class="iconfont icon-icon"></i>扫描发货</li>
				<li class="lot"><i class="iconfont icon-iconfontdaifahuo"></i>批量发货</li>
				<li class="query"><i class="iconfont icon-chaxun"></i>查询标签</li>
				<li class="ChangePassword"><i class="iconfont icon-xiugai"></i>修改密码</li>
				<li class="logout"><i class="iconfont icon-tuichu"></i>退出登录</li>
			</ul>
		</nav>
	</section>
	<div id="SlideMaskLayer"></div>
	
	<section class="FormBlockTwo" id="FormBlockTwo">
		
		<!-- 页眉 -->
	    <section>
		    <script type="text/javascript">
		        writePageHeader('');
		    </script>
	    </section>
	    
	    <!-- 内容 -->
	    <section class="AllContent" id="pullrefresh">
	    	
	    	<div class="SiteMain">
		    	<!-- 焦点图 -->
			    <section>
				    <script type="text/javascript">
				        FocusPicture();
				    </script>
			    </section>
	    		
	    		<div class="SiteMainHeader">
	    			<ul>
						<li>
							<p>标签总数</p>
							<p> </p>
						</li>
						<li ><i class="iconfont icon-biaoqian"></i>&nbsp;<i id="productCount"></i></li>
					</ul>
					
					<ul>
						<li>
							<p id="branchCount">网点名称 </p>
							<p> </p>
						</li>
						<li style="color:#00a9ed;font-size:1.1em;"><!--<i class="iconfont icon-shijian"></i>--><i id="companyCount">0</i></li>
					</ul>
	    		</div>
	    		
	    		<div class="SiteMainBlock">
	    			<ul>
	    				<li class="query">
	    					<p><i class="iconfont icon-chaxun"></i></im></p>
	    					<p>查询标签</p>
	    				</li>
	    				<li class="videoClassify">
	    					<p><i class="iconfont icon-saoma"></i></im></p>
	    					<p>扫描发货</p>
	    				</li>
	    				<li class="lot">
	    					<p><i class="iconfont icon-iconfontdaifahuo"></i></im></p>
	    					<p>批量发货</p>
	    				</li>
	    				<li class="ChangePassword">
	    					<p><i class="iconfont icon-xiugai"></i></im></p>
	    					<p>修改密码</p>
	    				</li>
	    				<li class="package_lot">
	    					<p><i class="fa fa-suitcase"></i></im></p>
	    					<p>箱码发货</p>
	    				</li>
	    				<li class="tag_pack">
	    					<p><i class="fa fa-inbox"></i></im></p>
	    					<p>箱码打包</p>
	    				</li>
	    				<li class="AddBlock">
	    					<p style="color:#666"><i class="iconfont icon-tianjia"></i></i></p>
	    					<p style="color:#666">添加</p>
	    				</li>
	    			</ul>
	    		</div>
	    		
	    		<p class="CopyRight">因驰追溯码系统 V<i></i></p>
	    	
	    	</div>
	    </section>
	</section>
</section>
</body>
<script type="text/javascript" src="js/jquery.min.js" ></script>
<script type="text/javascript" src="js/swiper-3.3.1.min.js" ></script>
<script type="text/javascript" src="js/mui.min.js" ></script>
<script type="text/javascript" src="js/AllJS.js" ></script>
<script type="text/javascript" src="js/echarts/common.js" ></script>
<script type="text/javascript" src="js/update.js" ></script>
<script type="text/javascript">
    mui.init({
		pullRefresh: {
			container: '#pullrefresh',
			down: {
				contentdown : "<div style='text-align:center;fonr-size:0.95em;color:#ccc;'>下拉刷新</div>",
			    contentover : '<div style="width:100%;background:#fff;"><img style="width: 20%;margin:0px auto;display:block;" src="images/loading5_.jpg" /><p style="text-align:center;color:#777;padding:5px 0px;">释放加载...</p></div>',
			    contentrefresh : '<div style="width:100%;background:#fff;"><img style="width: 20%;margin:0px auto;display:block;" src="images/loading5.gif" /><p style="text-align:center;color:#777;padding:5px 0px;">正在加载...</p></div>',
				callback: pullupRefresh,
			}
		}
	});
	
	function pullupRefresh() {
        $("#productCount").text(0);
        $("#companyCount").text(0);
		
        document.addEventListener('deviceready', onDeviceReady, true);
        $.ajax({//一个Ajax过程
            type: "post", //以post方式与后台沟通
            url: getServerUrl() + "/Open/ComStat/index", //与此php页面沟通
            dataType: 'json', //从php返回的值以 JSON方式 解释
            data: 'access_token=' + getToken(),
            success: function (json) {//如果调用php成功
                if(json.result == "1"){
                    $("#productCount").text(json.tag_total);
                    $("#companyCount").text(TimeNum);
        			$('.AllContent').css({backgroundColor:'#f3f3f3'});
		
					mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
		
                }else{
                    alertMessage(json_error_description);
                }

            }
        });
	}
    
    var MyTime = new Date();
	var xYear = MyTime.getFullYear();
	var xMonth = MyTime.getMonth();
	var xDate = MyTime.getDate();
	xMonth++;
	var TimeNum = xYear+"年"+xMonth+"月"+xDate+"日"
	$('#companyCount').text(TimeNum);
    
  	var publicity = new Swiper('.swiper-publicity',{
		autoplay: 3000
	});
	
	var clickNum = 1;
	$('.AddBlock').on('tap',function(){
		if(clickNum == 1){
			$(this).find('p:eq(0)').css({transform:'rotate(360deg)',transition:'All 1s ease-in-out',color:'#ccc'});
			$(this).find('p:eq(1)').text('没有更多').css({transition:'All 1s ease-in-out',color:'#ccc'});
			clickNum++;
		}else{
			$(this).find('p:eq(0)').css({transform:'rotate(-360deg)',transition:'All 1s ease-in-out',color:'#666'});
			$(this).find('p:eq(1)').text('添加').css({transition:'All 1s ease-in-out',color:'#666'});
			clickNum--;
		}
	});
	
	$('#CtyQuery').on('tap',function(){
		mui.openWindow({
			 url: 'query.html', 
		    id:'query.html'
		});
	});

	jQuery(function () {
        $("#homepagemessageid").hide();
        $("#homepagemessageid").html("");
        document.addEventListener('deviceready', onDeviceReady, true);
        $.ajax({//一个Ajax过程
            type: "post", //以post方式与后台沟通
            url: getServerUrl() + "/Open/ComStat/index", //与此php页面沟通
            dataType: 'json', //从php返回的值以 JSON方式 解释
            data: 'access_token=' + getToken(),
            success: function (json) {//如果调用php成功
                if(json.result == "1"){
                    $("#productCount").text(json.tag_total);
                    var t = getCompanyName(json.branch_total);
                    $("#branchCount").text(t);
                }else{
                    alertMessage('请检查网点是否正确！');
                    $("#productCount").text(0);
                }

            }
        });
        
        var u = navigator.userAgent, app = navigator.appVersion;
		var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
		var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
		
		if (+isAndroid) {
	    	$('.SiteMain').css({marginTop:'0px'});
	    	var ScrollTop = $('#pullrefresh').scrollTop();
			if(ScrollTop == 0){
		    	$('#pullrefresh').on('swipedown',function(){
			        $("#productCount").text(0);
			        $("#companyCount").text(0);
			        $('#pullrefresh').prepend('<div id="AddLoading" style="width:100%;background:#fff;"><img style="width: 20%;margin:0px auto;display:block;" src="images/loading5.gif" /><p style="text-align:center;color:#777;padding:5px 0px;">正在加载...</p></div>');
		    		$('#pullrefresh').animate({scrollTop:0},500);
		    		$.ajax({//一个Ajax过程
			            type: "post", //以post方式与后台沟通
			            url: getServerUrl() + "/Open/ComStat/index", //与此php页面沟通
			            dataType: 'json', //从php返回的值以 JSON方式 解释
			            data: 'access_token=' + getToken(),
			            success: function (json) {//如果调用php成功
			                if(json.result == "1"){
			                    $("#productCount").text(json.tag_total);
			                    $("#companyCount").text(TimeNum);
			        			$('.AllContent').css({backgroundColor:'#f3f3f3'});
								$('#AddLoading').remove();
					
			                }else{
			                    alertMessage(json_error_description);
			                }
			
			            }
			        });
		    	});
			}
			
		}else{
			$('.SiteMain').css({marginTop:'-23px'});
		}
        
        
    });
    function onDeviceReady() {
        //autoCheckAppVersion();
        document.addEventListener("backbutton", onBackKeyDown, false);
    }
    function onBackKeyDown() {
        hideLoading();
        // Handle the back button
        exitFromApp();
    }

    function onsuccess() {
    }
    function proccessTextQuery() {
        if(!empty($("#itemcode").val())) {
            loadUrl("query.html", "itemcode", $("#itemcode").val());
        }else {
            alert("请输入产品编号！");
        }

    }
//	$('.SiteMainHeader ul:eq(0)').on('click',function(){
//		location.href = "products.html"
//	});
//	$('.SiteMainHeader ul:eq(1)').on('click',function(){
//		location.href = "ScreentoneList.html"
//	})
	
	$(function(){
		//扫描器
		$(".Scanner").on('tap',function(){
		  mui.openWindow({
		    url: 'Scanner.html?etk=3', 
		    id:'Scanner.html'
		  });
		});
		
		//扫描发货
		$(".videoClassify").on('tap',function(){
		  mui.openWindow({
		    url: 'scan.html', 
		    id:'scan.html'
		  });
		});
		
		//查询标签
		$(".query").on('tap',function(){
		  mui.openWindow({
		    url: 'query.html', 
		    id:'query.html'
		  });
		});
		
		//批量发货
		$(".lot").on('tap',function(){
		  mui.openWindow({
		    url: 'lot.html', 
		    id:'lot.html'
		  });
		});
		
		//退出应用
		$(".logout").on('tap',function(){
		  logout();
		});
		
		//修改密码
		$(".ChangePassword").on('tap',function(){
		  mui.openWindow({
		    url: 'ChangePassword.html', 
		    id:'ChangePassword.html'
		  });
		});
		
		//标签包发货
		$(".package_lot").on('tap',function(){
		  mui.openWindow({
		    url: 'package_lot.html', 
		    id:'package_lot.html'
		  });
		});
		
		//箱码打包
		$(".tag_pack").on('tap',function(){
		  mui.openWindow({
		    url: 'tag_pack.html', 
		    id:'tag_pack.html'
		  });
		});
	});
	
	var showMenu = false;
	mui.plusReady(function() {
	    //首页返回键处理
		//处理逻辑：1秒内，连续两次按返回键，则退出应用；
		var first = null;
		mui.back = function() {
			if (showMenu) {
				closeMenu();
			} else {
				//首次按键，提示‘再按一次退出应用’
				if (!first) {
					first = new Date().getTime();
					mui.toast('再按一次退出应用');
					setTimeout(function() {
						first = null;
					}, 1000);
				} else {
					if (new Date().getTime() - first < 1000) {
						plus.runtime.quit();
					}
				}
			}
		};
	});
	
	mui.init({
	  preloadPages:[
	  	{
	      url:'ChangePassword.html',
	      id:'ChangePassword.html'
	    }
	  ]
	});
	
</script>
</html>